#include "client.h"
#include <stdio.h>


void Cl_Disconnect(CClient *c, const char *szReason)
{
	CPacket *p = new CPacket(255);
	p->Write(szReason);

	c->Send(PMS_DISCONNECT, p);
};


bool CClient::MSG_Identify(CPacket* packet)
{
	char szIdent[32];
	packet->ReadString(szIdent, 31);

	if (strcmp(szIdent, "PKMNOV01") == 0)
	{
		// TODO: Stuff...;

	}
	else
	{
		char msg[1025];
		sprintf(msg, "You have been disconnected. You are using a unsupported (%s) client.", szIdent);
		Cl_Disconnect(this, msg);
	}
	return true;
}

bool CClient::MSG_Login(CPacket *packet)
{
	// TODO: Send PMO_CHANGELEVEL, PMO_UPDATEPOS, and a PMO_CREATEACTOR for every other connected client.
	return false;
}

bool CClient::MSG_Move(CPacket *packet)
{
	// TODO: Check if client can move in the requested direction. If it can't disconnect the client.
			//       If it can move send a PMO_UPDATEACTOR to all other clients to inform them this client is moving.
	return false;
}
